package com.filiebo.demo.leetcode;

public class ArrayOnlyElement {


    public int arrayOnly(int[] array) {

        int newArray = 0;
        for (int i1 : array) {
            newArray ^= i1;
        }
        return newArray;
    }

    public int getModeNumber(int[] nums) {
        int newInt;
        int newElement = 0;
        int moblie = nums.length / 2;
        for (int i = 0; i < nums.length; i++) {
            newInt = 0;
            for (int j = 0; j < nums.length; j++) {
                if (nums[i] == nums[j]) {
                    newInt++;
                }
            }
            if (newInt > moblie) {
                newElement = nums[i];
                break;
            }
        }
        return newElement;
    }


    public boolean searchMatrix(int[][] matrix, int target) {
        boolean flag = false;
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix.length; j++) {
                if (matrix[i][j] < target && matrix[i][j+1] >target){

                }
            }
        }

        return flag;
    }
}
